package com.test.pattern.observer.jdkobserver;

import java.util.Observable;

/**
 * @ClassName: Thief
 * @description: 集成jdk被观察者类
 * @author: Mr du
 * @create: 2024-03-16 23:01
 */
public class Thief extends Observable {

    private String name;

    public Thief(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void steal(){
        System.out.println("小偷：我偷东西了，有没有人来抓我！！！");
        super.setChanged();
        super.notifyObservers();
    }
}
